﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="StorageManage.login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>用户登录</title>
    <style type="text/css">
        #btnSubmit:hover{background-color:#0000ff}
        #btnSubmit:active{background-color:#0e0e8c}
    </style>
    <link href="Content/css/login.css" rel="stylesheet" />    
    <link href="Scripts/jquery-plugin/showloading/showLoading.css" rel="stylesheet" />
    <script src="Scripts/Jquery/jquery-1.11.0.min.js"></script>
    <script src="Scripts/jquery-plugin/showloading/jquery.showLoading.min.js"></script>
    <script src="Scripts/Common/common.js"></script>
    <script type="text/javascript">
        $(function () {
                $(document).keydown(function(event){ 
                    if(event.keyCode==13){ 
                        $("#btnSubmit").click();
                        $('#btnSubmit').css('background-color', '#0e0e8c')
                    } 
                })
        })
        function funcSubmit() {
            var username = $('#txtUserName').val();
            var password = $('#txtUserPwd').val();          
            $.ajax({
                url: 'Logic/HandlerLogin.ashx',
                type: 'post',
                data: { username: username, password: password },
                dataType: 'text',
                beforeSend: function () {
                    // 禁用按钮防止重复提交
                    $('#loginbody').showLoading();
                },
                success: function (data) {
                    if (data == "ok") {
                        setTimeout('success()', 500)
                    } else {
                        $('#loginbody').hideLoading();
                        $('#msgtip').html('用户名或密码错误，请重新输入！').css('color', 'red');
                        $('#txtUserPwd').val('');
                    }
                }
            });
        }
        function success() {
            $('#loginbody').hideLoading();
            window.location.href = "/index.aspx";
        }

    </script>
</head>
<body class="loginbody" id="loginbody">
    
        <div style="width: 100%; height: 100%; min-width: 300px; min-height: 260px;"></div>
        <div class="login-wrap">
            <div class="login-logo">海港中材余料管理系统</div>
            <div class="login-form">
                <div class="col">
                    <input type="text" name="txtUserName" id="txtUserName" class="login-input" placeholder="用户名" />                    
                    <label class="icon user" for="txtUserName"></label>
                </div>
                <div class="col">
                     <input type="password" name="txtUserPwd" id="txtUserPwd" class="login-input" placeholder="用户密码" />                    
                    <label class="icon pwd" for="txtPassword"></label>
                </div>
                <div class="col">
                   
                    <input type="button" name="btnSubmit" id="btnSubmit" class="login-btn" onclick="funcSubmit()" value="登录" />
                </div>
            </div>
            <div class="login-tips">
                <p id="msgtip"></p>
            </div>
            
        </div>

        <div class="copy-right">
            <p>版权所有 SGMW Copyright © 2018. All Rights Reserved.<br />
                开发技术支持：武汉理工大学</p>
        </div>
    
</body>
</html>
